{
Function:       _LowestFC

Description:    More efficient function to replace TS function Highest.
                Unlike TS function ExtremesFC, in this function Length may vary.

Author:         MarkSanDiego

Updated:        04/24/10    original version
                04/25/10    improved method based on Goose's inline code

Usage:
_____________________________________________________________

    value1 = _Lowest(Price, Length);
_____________________________________________________________
}
inputs: 
    Price(NumericSeries),
    Length(NumericSimple);

variables:  
    intrabarpersist xLowest(Lowest(Price, Length)),
    intrabarpersist LastLength(Length),
    j(0);

    if Length <> LastLength then begin
        
        LastLength = Length;
        xLowest = Price;
        for j = 1 to Length - 1 begin
            xLowest = MinList(Price[j], xLowest);
        end;

    end else begin

        if Price < xLowest then
            xLowest = Price
        else if Price[Length] > xLowest then
            value1 = 0                                  { do nothing }
        else begin
            xLowest = Price;
            for j = 1 to Length - 1 begin
                xLowest = MinList(Price[j], xLowest);
            end;
        end;

    end;

    _LowestFC = xLowest;
